package com.cn.entity;

import java.util.Date;

import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.search.annotations.DocumentId;

@Entity
@Table(name="smstimer")
@GenericGenerator(name = "system-uuid",strategy = "uuid")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SMSTimer {
	
	/**
	 * ID
	 */
	@Id
	@GeneratedValue(generator="system-uuid")
	@Column(name="smsTimerID",length=32)
	@DocumentId(name="smsTimerID")
	public String smsTimerID;
	/**
	 * 创建时间
	 */
	@Column(name="createDate")
	public Date createDate;
	
	/**
	 * 任务名称
	 */
	@Column(name="jobName",unique=true)
	public String jobName;
	
	/**
	 * 
	 * 定时时间
	 */
	@Column(name="timingDate")
	public Date timingDate;
	/**
	 * 接收号码
	 */
	@Column(name="receiveNum",length=1500)
	public String receiveNum;
	/**
	 * 短信内容
	 */
	@Column(name="smsContext")
	public String smsContext;
	/**
	 * 发送状态
	 * 0:待发送
	 * 1：正常发送
	 * 2：取消发送
	 */
	@Column(name="state")
	public String state;
	
	/**
	 * 管理员
	 */
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@JoinColumn(name = "userBase")
	public UserBase userBase;
	
	/**
	 * 运营商
	 */
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@JoinColumn(name = "smsOperator")
	public SMSOperator smsOperator;
	/**
	 * 业务
	 */
	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@JoinColumn(name = "smsBusiness")
	public SMSBusiness smsBusiness;
	
	public SMSTimer()
	{
		this.createDate = new Date();
		this.state="0";
	}

	/**
	 * ID
	 */
	public String getSmsTimerID() {
		return smsTimerID;
	}

	/**
	 * 创建时间
	 */
	public Date getCreateData() {
		return createDate;
	}

	/**
	 * 
	 * 定时时间
	 */
	public Date getTimingDate() {
		return timingDate;
	}

	/**
	 * 接收号码
	 */
	public String getReceiveNum() {
		return receiveNum;
	}

	/**
	 * 短信内容
	 */
	public String getSmsContext() {
		return smsContext;
	}

	/**
	 * 业务
	 */
	public String getState() {
		return state;
	}

	/**
	 * 运营商
	 */
	public SMSOperator getSmsOperator() {
		return smsOperator;
	}

	/**
	 * 业务
	 */
	public SMSBusiness getSmsBusiness() {
		return smsBusiness;
	}

	/**
	 * ID
	 */
	public void setSmsTimerID(String smsTimerID) {
		this.smsTimerID = smsTimerID;
	}

	/**
	 * 创建时间
	 */
	public void setCreateData(Date createData) {
		this.createDate = createData;
	}

	/**
	 * 
	 * 定时时间
	 */
	public void setTimingDate(Date timingDate) {
		this.timingDate = timingDate;
	}

	/**
	 * 接收号码
	 */
	public void setReceiveNum(String receiveNum) {
		this.receiveNum = receiveNum;
	}

	/**
	 * 短信内容
	 */
	public void setSmsContext(String smsContext) {
		this.smsContext = smsContext;
	}

	/**
	 * 业务
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * 运营商
	 */
	public void setSmsOperator(SMSOperator smsOperator) {
		this.smsOperator = smsOperator;
	}

	/**
	 * 业务
	 */
	public void setSmsBusiness(SMSBusiness smsBusiness) {
		this.smsBusiness = smsBusiness;
	}

	/**
	 * 任务名称
	 */
	public String getJobName() {
		return jobName;
	}

	/**
	 * 任务名称
	 */
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	/**
	 * 创建时间
	 */
	public Date getCreateDate() {
		return createDate;
	}

	/**
	 * 管理员
	 */
	public UserBase getUserBase() {
		return userBase;
	}

	/**
	 * 创建时间
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	/**
	 * 管理员
	 */
	public void setUserBase(UserBase userBase) {
		this.userBase = userBase;
	}
	
	
	
	
	

}
